import JSEncrypt from 'jsencrypt';
// 密钥对生成 http://web.chacuo.net/netrsakeypair

const publicKey = `MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAxffjmP8Tp162HkTYwp8b
ERvPAaBImxaqiilFCxLbD63AObDHNen5BgSP0ameNOc917xtqiho9dqYA8hR1NPm
a16J/Huv1RNvNJcJDpApoz8TVUf+2QHL001KpU9uIU7D9iswmKacsj0WnWm8GulJ
c0vw7Bk4eZJEmnj9rC8NJOOuv5H+q7+I3sfu8nIFA8YvTYpMDTrkPSGA+avYevvr
YOXy5gDjsHDNmI3h5kVtUOI5W0EI4DEA92H11IjaSDOvN8Ga8uC2V1h5/JadND7o
wR7+kt53L+ODhUwxALw1t1QJSxcbCEgleYkkMBTrWCA84T1JgTgstUk/ZeW41Ta3
CwIDAQAB`

// 加密
export function encrypt(txt) {
  const encryptor = new JSEncrypt()
  encryptor.setPublicKey(publicKey) // 设置公钥
  return encryptor.encrypt(txt) // 对数据进行加密
}
